import { expressjwt } from "express-jwt"
import filterPath from "../jwt/filterPath"
import fs from "fs"
import path from "path"
// 秘钥
const secret = fs.readFileSync(path.join(__dirname, "../jwt/screct.txt"), "utf-8")
export default () => {
    return expressjwt({
        secret: secret, // 密钥
        algorithms: ['HS256'], // 设置使用的算法类型
        credentialsRequired: false //是否允许无token请求
    }).unless({
        path: filterPath //除了这个地址，其他的URL都需要验证
    })
}